package com.bee.bootstrap.plugs.shiro;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class ShiroMd5Util {

    public static String  generatePassword(String userName,String crdentials,String salt) {
        String hashAlgorithmName = "MD5";//加密方式
        ByteSource crdentialsSalt = ByteSource.Util.bytes(salt);//以账号作为盐值
        int hashIterations = 1024;//加密1024次
        SimpleHash hash = new SimpleHash(hashAlgorithmName,crdentials,crdentialsSalt,hashIterations);
        return hash.toString();
    }

    public static void main(String[] args) {
        System.out.println(generatePassword("admin","123456","admin"));
    }


}
